package com.foreknow.elm.controller;

import com.foreknow.elm.po.Business;
import com.foreknow.elm.po.Deliveryaddress;
import com.foreknow.elm.po.Food;
import com.foreknow.elm.service.BusinessService;
import com.foreknow.elm.service.impl.BusinessServiceImpl;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

public class BusinessController {
    /**
     * 请求地址  http://localhost:8080/MavenElmWebProject/BusinessController/listBusinessByOrderTypeId?orderTypeId=1
     * @param request
     * @return
     */
    public Object listBusinessByOrderTypeId(HttpServletRequest request){
        //获取请求参数
        String orderTypeId = request.getParameter("orderTypeId");
        //调用Service层的方法
        BusinessService service = new BusinessServiceImpl();
        List<Business> list= service.listBusinessByOrderTypeId(Integer.valueOf(orderTypeId));
      return  list;
    }

    /**
     * 请求地址  http://localhost:8080/MavenElmWebProject/BusinessController/getBusinessById?businessId=10001
     * @param request
     * @return
     */
    public Object getBusinessById(HttpServletRequest request){
        //获取请求参数
        String businessId = request.getParameter("businessId");
        //调用Service层的方法
        BusinessService service = new BusinessServiceImpl();
        Business business = service.getBusinessById(Integer.valueOf(businessId));
        return business;
    }




}
